home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 090 / pctj8406.arc / SIMPLE.PRG < prev    next >
Text File  |  1986-09-14  |  4KB  |  106 lines

  1.  
  2. SET TALK OFF
  3. ERASE
  4. STORE f TO terminate
  5. * - controls repetition of the entire program
  6. DO WHILE (.not. terminate)
  7.  
  8.    *( 
  9.    *( The bulk of the program would 
  10.    *( go here, within the major loop
  11.    *( controlled by the logical 
  12.    *( memvar "terminate" - the validation
  13.    *( loop appears below
  14.    *( 
  15.  
  16.    **********************************************
  17.    * - VALIDATION LOOP
  18.    * - obtain a valid Yes or No answer 
  19.  
  20.    * - create the memvars "answer" and "answered"
  21.    STORE "Y" TO answer
  22.    STORE  f  TO answered 
  23.  
  24.    * - clear the screen
  25.    ERASE
  26.  
  27.    * - ask until a proper answer is given
  28.    DO WHILE .not. answered
  29.  
  30.       * - ask the question...
  31.       @ 10,5 SAY "Do you wish to continue? (Y/N)"
  32.  
  33.       * - get the answer, forcing it to upper case
  34.       @ $,$+2 GET answer PICTURE "!"
  35.       READ
  36.  
  37.       * - deactivate the GET field
  38.       CLEAR GETS
  39.  
  40.       * - erase any previous error messages
  41.       @ 10,0
  42.       @ 11,0
  43.  
  44.       * - test the answer, respond appropriately
  45.       DO CASE
  46.  
  47.          * - if the answer is NO:
  48.          CASE answer = "N"
  49.             * - we have a valid answer, and
  50.             STORE t TO answered
  51.             * - the answer means we should terminate
  52.             STORE t TO terminate
  53.             ERASE
  54.             * - we show that we are terminating
  55.             @ 10,10 SAY "Terminating, please stand by."
  56.  
  57.          * - if the answer is YES:
  58.          CASE answer = "Y"
  59.             * - we have a valid answer, and
  60.             STORE t TO answered
  61.             * - the answer means we don't terminate
  62.             STORE f TO terminate
  63.             * - we indicate that answer has been accepted
  64.             @ 11,10 SAY "Continuing."
  65.  
  66.          * - the answer was something else (anything)
  67.          OTHERWISE
  68.             * - we don't yet have a good answer
  69.             STORE f TO answered
  70.             * - we ask for a better answer
  71.             @ 11,10 SAY "Please answer Yes or No....." 
  72.             
  73.       ENDCASE
  74.  
  75.       * - try again if "answered" is still false
  76.    ENDDO - while not answered 
  77.  
  78.    * - release the loop variables
  79.    RELEASE answer, answered
  80.  
  81.    ERASE
  82.  
  83. ENDDO - while not terminate
  84. RELEASE terminate
  85.  
  86. * - terminate the program
  87. QUIT
  88.  
  89. ***                                                                          
  90.                                                                              
  91.                                                                              
  92.                                                                              
  93.                                                                              
  94.                                                                              
  95.                                                                              
  96.                                                                              
  97.                                                                              
  98.                                                                              
  99.                                                                              
  100.                                                                              
  101.                                                                              
  102.                                                                              
  103.                              
  104.                                                                              
  105.                                                                              
  106.